package org.example;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import jfxtras.styles.jmetro.JMetro;
import jfxtras.styles.jmetro.Style;

public class App extends Application {
    private static JMetro jMetro;
    public static ConfigLoader mConfig;
    @Override
    public void start(Stage stage) throws Exception {
        mConfig = new ConfigLoader();
        mConfig.loadProperties();

        stage.setTitle("Android性能测试助手 V1.0");
        stage.setResizable(false);
        stage.getIcons().add(new Image("image/icon.png"));

        FXMLLoader fxmlLoader = new FXMLLoader();
        fxmlLoader.setLocation(getClass().getResource("main.fxml"));
        Parent load = fxmlLoader.load();
        Scene scene = new Scene(load);
        MainController controller = fxmlLoader.getController();
        controller.setStage(stage);

        jMetro = new JMetro(Style.LIGHT);
        useJMetro(scene);

        stage.setScene(scene);
        stage.show();
    }

    public static void useJMetro(Scene scene) {
        if (jMetro != null) {
            jMetro.setScene(scene);
        }
    }

    public static void main(String[] args) {
        launch();
    }
}